# Contributor: Ivan Tham <pickfire@riseup.net>
# Maintainer: Ivan Tham <pickfire@riseup.net>
pkgname=opencc
_pkgname=OpenCC
pkgver=1.1.1
pkgrel=0
pkgdesc="Open Chinese Convert"
url="http://opencc.byvoid.com/"
arch="all"
license="Apache-2.0"
makedepends="cmake doxygen python3"
subpackages="$pkgname-dev $pkgname-doc"
source="$pkgname-ver.$pkgver.tar.gz::https://github.com/BYVoid/$_pkgname/archive/ver.$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-ver.$pkgver"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DBUILD_DOCUMENTATION=on \
		-DBUILD_TESTING=off \
		. $CMAKE_CROSSOPTS
	make -C build
}

package() {
	make -C build DESTDIR="$pkgdir" install

	mkdir -p "$pkgdir"-doc/usr/share/doc
	mv "$pkgdir"/usr/share/$pkgname/doc "$pkgdir"-doc/usr/share/doc/$pkgname
}

sha512sums="48ccf61f63cf0a1c0fc484a52ae1d406a28949a52be7d7d1595e6aaf87f40ac47ea4697308441a9381f0cd6f404ee5a28b85a2fa2f288c4b3933be36f4a41363  opencc-ver.1.1.1.tar.gz"
